﻿using System.Collections.Generic;

namespace Citi.ExpenseReport.WebUI.Models
{
    public class MappingColumnModel
    {
        public int SoeId { get; set; }
        public int SubService { get; set; }
        public int Amount { get; set; }
        public int Date { get; set; }
        public int UnitCost { get; set; }
        public int Details { get; set; }
        public Dictionary<int, int> SubServiceInColumns { get; set; }
        public bool FileHasPrice { get; set; }

        public MappingColumnModel()
        {
            SoeId = -1;
            SubService = -1;
            Amount = -1;
            Date = -1;
            UnitCost = -1;
            Details = -1;
        }

        public MappingColumnModel(MappingFileType type)
            : this()
        {
            switch (type)
            {
                case MappingFileType.Application:
                    MappingApplication();
                    break;
                case MappingFileType.Email:
                    MappingEmail();
                    break;
                case MappingFileType.Desgold:
                    MappingDesgold();
                    break;
                case MappingFileType.Telecom:
                    MappingTelecom();
                    break;
                case MappingFileType.Communicator:
                    MappingCommunicator();
                    break;
                case MappingFileType.DesktopLaptop:
                    MappingDesktopLapTop();
                    break;
                case MappingFileType.ThinClient:
                    MappingThinClient();
                    break;
                case MappingFileType.Modem3GClaro:
                    MappingModem3GClaro();
                    break;
                case MappingFileType.Modem3GVivo:
                    MappingModem3GVivo();
                    break;
            }
        }

        private void MappingThinClient()
        {
            Details = 2;
            SoeId = 7;
        }

        private void MappingDesktopLapTop()
        {
            Details = 1;
            SoeId = 9;
        }

        private void MappingDesgold()
        {
            SoeId = 10;
            SubService = 2;
        }

        private void MappingApplication()
        {
            SoeId = 3;
            Details = 2;
            SubService = 5;
        }

        private void MappingEmail()
        {
            SoeId = 0;
        }

        private void MappingModem3GVivo()
        {
            Details = 0;
            SoeId = 1;
            UnitCost = 2;
        }

        private void MappingModem3GClaro()
        {
            Details = 0;
            SoeId = 1;
            UnitCost = 2;
        }

        private void MappingCommunicator()
        {
            SoeId = 0;
        }

        private void MappingTelecom()
        {
            SoeId = 0;
            FileHasPrice = true;

            SubServiceInColumns = new Dictionary<int, int>
                {
                    {1, (int) Telecom.Local},
                    {2, (int) Telecom.DDD},
                    {3, (int) Telecom.DDI},
                    {4, (int) Telecom.MovelLocal},
                    {5, (int) Telecom.MovelDDD}
                };
        }
    }

    public enum Telecom
    {
        Local = 13,
        DDD = 14,
        DDI = 15,
        MovelLocal = 16,
        MovelDDD = 17,
    }

    public enum MappingFileType
    {
        Application,
        Email,
        Desgold,
        Telecom,
        Communicator,
        ThinClient,
        DesktopLaptop,
        Modem3GVivo,
        Modem3GClaro
    }
}